"use server";
import { getQuestionVoByIdUsingGet } from "@/api/questionController";
import QuestionCard from "@/components/QuestionCard";
import "./index.css";

/**
 * 题目详情页
 * @constructor
 */
export default async function QuestionPage({ params }) {
  const { questionId } = params;


  // 获取题目信息
  let question = undefined;
  try {
    const res = await getQuestionVoByIdUsingGet({
      id: questionId,
    });
    question = res.data;
  } catch (error: any) {}
  // 题库列表获取失败时返回
  if (!question) {
    return <div>题目获取失败</div>;
  }


  return (
    <div id="questionPage">
      <QuestionCard question={question} />
    </div>
  );
}
